﻿using FluentNHibernate.Mapping;
using Messenia.Data.Models;

namespace Messenia.Data.Hibernate.Map {
    public class GroupMap: ClassMap<Group> {
        public GroupMap() {
            Table("Groups");
            Id(x => x.GroupId , "Group_ID");
            Map(x => x.Name);
            Map(x => x.Description);
            HasMany(x => x.Resources)
            .AsBag()
            .Table("groups_resources")
            .KeyColumn("Group_ID")
            .KeyColumn("HumanResource_ID")
            .Inverse().Not.LazyLoad();

        }

    }
}
